package com.efast.dmom.aps.datahandlers;

import java.util.ArrayList;
import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import com.efast.cafe.framework.util.SpringWebUtils;
import com.efast.dmom.aps.bean.PlanOrderPartAnalysisResult;
import com.efast.dmom.aps.dao.PlanOrderPartAnalysisResultDao;
import com.efast.dmom.aps.entity.PlanOrderPartAnalysisResultEntity;
import com.efast.dmom.aps.util.TimeUtil;

@Component
public class PlanOrderPartAnalysisResultDataHandler {
	
	@Autowired
	private PlanOrderPartAnalysisResultDao planOrderPartAnalysisResultDao;

	public void saveList(List<PlanOrderPartAnalysisResult> analysisResultList) {
		List<PlanOrderPartAnalysisResultEntity> list = new ArrayList<PlanOrderPartAnalysisResultEntity>();
		for (PlanOrderPartAnalysisResult obj:analysisResultList) {
			obj.getInnerData().setSiteId(DataHandlerUtils.getSiteId());
			obj.getInnerData().setCreationTime(TimeUtil.getLocalDateTime());
			obj.getInnerData().setCreationTimeZone(TimeUtil.getLocalTimeZone());
			obj.getInnerData().setCreator(SpringWebUtils.getRequestUser());
			obj.getInnerData().setLastModifiedTime(TimeUtil.getLocalDateTime());
			obj.getInnerData().setLastModifiedTimeZone(TimeUtil.getLocalTimeZone());
			obj.getInnerData().setLastModifier(SpringWebUtils.getRequestUser());
			obj.getInnerData().setCreationPid(1);
			obj.getInnerData().setLastModifiedPid(1);
			obj.getInnerData().setRowStatus(1);
			obj.getInnerData().setRowTrxId(1);
			list.add(obj.getInnerData());
		}
		planOrderPartAnalysisResultDao.saveList(list);
	}

	public void deleteAll() {
		planOrderPartAnalysisResultDao.deleteAll();		
	}

}
 